using System;
using System.Linq;
using CommandSystem;
using Exiled.API.Features;
using RgCore.PlayerHud;

namespace RgCore.Commands
{
    [CommandHandler(typeof(ClientCommandHandler))]
    public class HelpCommand : ICommand
    {
        public string Command => "h";

        public string[] Aliases => Array.Empty<string>();

        public string Description => "";

        public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
        {
            Player player = Player.Get(sender);
            string text = Utils.RAUtils.FormatArguments(arguments, 0);
            if (string.IsNullOrEmpty(text))
            {
                response = ":)";
                return false;
            }
            foreach (Player admin in Player.List.Where(x => x.RemoteAdminAccess))
            {
                admin.SendFormattedMsg("help", "<color=#00FFFF>管理请求</color>", $"<color=#00FF00>{player.Nickname}</color>: {text}", 10, MsgType.Message, ScreenLocation.CenterTop, true);
            }
            response = "已发送请求！如果有管理员在线，他们会收到回应，请耐心等待";
            return true;
        }
    }
}